package SuanFa;

import java.util.ArrayList;
import java.util.List;

public class ZheBan {
    public static void main(String[] args) {
        int[] arr = {1,3,6,9,12,23,33,44,45,67,78,98,100,111,123,1234,2345,9999,11111,12345,666666,900000};
        System.out.println(getZheBan(arr,67));
    }
    public static int  getZheBan(int [] array,int x){
        int op=0;
        int ed=array.length-1;
        int mid;
        while (op<=ed){
            mid=(op+ed)/2;
            if (array[mid]>x){
                ed=mid-1;
            }
            if (array[mid]<x){
                op=mid+1;
            }
            if (array[mid]==x){
                return mid;
            }
        }
        return -1;
    }
}
